Applying a custom filter for a specific query.
_tags
attribute to categorize meals depending on their individual qualities:
_tags
attribute. Because _tags
is already optimized for filtering, you don’t have to set it as an attribute for faceting. You can directly create a new Rule that detects the term “diet” in a query and applies a positive filter on tags “low-carb” and “low-fat”.
saveRule
method.
When creating a rule, you must define a condition and a consequence.
{ "filters": "'low-carb' OR 'low-fat'" }
.allergens
attribute (with “gluten” as one of the potential values).allergens
as an attributesForFaceting
in your index:
saveRule
method to create a rule that detects the term “gluten-free” in a query and applies a negative filter on facet value allergens:gluten
.allergens
attribute from the drop-down menu.
{ "filters": "NOT allergens:gluten" }
product_type
attribute from the drop-down menu.{ "filters": "product_type:toaster" }
{ "filters": "price<10" }